const marbleRaceConfig = {
	antiAlias: 'high',
	renderTimeDelta: 1000 / 30,
	canvas: document.getElementById('canvas'),
	leftPanel: document.getElementById('leftPanel'),
	rightPanel: document.getElementById('rightPanel'),
	levelTimeElement: document.getElementById('levelTime'),
	totalTimeElement: document.getElementById('totalTime'),
	statusMessageElement: document.getElementById('statusMessage'),
	theme: {
		lineWidth: 1,
		//fontSize: '12px',

		//fontSize: '16px',
		//fontFamily: 'Verdana',
		//fontValue: '14px Verdana',
		//fontText: 'bold 18px Verdana',
		fontSize: '15px',
		fontFamily: 'Bahnschrift Light',
		fontValue: '14px Bahnschrift Light',
		fontText: '18px Bahnschrift Light',
		ranklistColor: {
			1: '#FFD400',
			2: '#BFBFBF',
			3: '#5D3A17'
		},
		ranklistText: {
			1: '冠军🥇',
			2: '亚军🥈',
			3: '季军🥉'
		},
		textValueOffset: [10, 5],
		background: '#000000',
		foreground: '#FFFFFF',
		secondary: '#3F3F3F',
		tertiary: '#1F1F1F',
		launchBorderWidth: 5,
		launch: '#FF0000',
		a: '#FF0000',
		b: '#FFFF00',
		c: '#0000FF',
		goal: '#00FF00',
		sacrifice: '#00FFFF',
		eliminate: '#FF0000',
		stop: '#FF0000',
		stopRadiusScale: 1,
		showStopTime: true,
		ballRadius: 20,
		showTrail: true,
		trailLen: 10,
		displayStatus: true,
		//displayStatus: false,
		displayBallTag: false,
		displayRanklist: true
	},
	gravity: .0005,
	constant: {
		UNKNOWN: -1,
		UNFINISHED: 0,
		PASSED: 1,
		ELIMINATED: 2,
		WIN: 3,
		PROMOTED: 4,
		SACRIFICED: 5
	},
	startGameKeyCode: 'Enter',
	text: {
		startGamePrompt: 'Marble Race',
		level: '第%l关',
		rank: '第%r名',
		score: '%s',
		scoreTemporary: '(%s)',
		statusUnknown: '<span style="color:#08F">未知</span>',
		statusUnfinished: '<span style="color:#FF0">未过关</span>',
		statusPassed: '<span style="color:#0F0">%ts</span>',
		statusPromoted: '<span style="color:#080">已保送</span>',
		statusUnfinishedValue: '<span style="color:#FF0">[%v]</span>',
		statusPassedValue: '<span style="color:#0F0">[%v]</span>',
		statusEliminated: '<span style="color:#F00">%s</span>',
		statusWin: '<span style="color:#0F0">%s</span>'
	},
	statusMessage: {
		none: '&nbsp;',
		passed: '过关',
		unpassed: '被坑',
		promoted: '保送',
		eliminated: '淘汰',
		sacrificed: '被献祭',
		win: '获胜'
	},
	goPortalID: 'goal',
	isLevel: {
		elimination: true,
		rotate: true,
		value: true
	},
	nextLevelDelay: 3000,

	nextPageKeyCode: 'ArrowRight',
	prevPageKeyCode: 'ArrowLeft',
	nextPageInterval: 5000,
	nextPageIntervalForTotal: 1000,
	ranklistMaxDisplay: 10
}

if (marbleRaceConfig.canvas) {
	marbleRaceConfig.canvasContext = marbleRaceConfig.canvas.getContext('2d')
	if (marbleRaceConfig.antiAlias) {
		marbleRaceConfig.canvasContext.imageSmoothingEnabled = true
		marbleRaceConfig.canvasContext.imageSmoothingQuality = marbleRaceConfig.antiAlias
	}
}

document.body.style.backgroundColor = marbleRaceConfig.theme.background
document.body.style.color = marbleRaceConfig.theme.foreground
document.body.style.fontFamily = marbleRaceConfig.theme.fontFamily
document.body.style.fontSize = marbleRaceConfig.theme.fontSize